//
//  JiaoYiOrderViewController.m
//  ChinaA
//
//  Created by Mxionlly on 2018/11/6.
//  Copyright © 2018 Evan. All rights reserved.
//

#import "JiaoYiOrderViewController.h"
#import "segmentedControlView.h"
#import "DWPageViewController.h"
#import "JiaoYiOrderBuyViewController.h"
#import "JiaoYiOrderSellViewController.h"

@interface JiaoYiOrderViewController ()<BMPageViewControllerDelegate,segmentedControlViewDelegate>
@property (nonatomic,strong) segmentedControlView     *tabView;
@property (nonatomic,strong) UIView *pageContentView;
@property (nonatomic,strong)DWPageViewController *pageVC;
@end

@implementation JiaoYiOrderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"交易订单";
    self.supheadView.frame = CGRectMake(0, 0, KScreenWidth, 150);
    
    [self initUI];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.hidesBottomBarWhenPushed = NO;
    self.tabBarController.tabBar.hidden = YES;
    self.navigationController.navigationBar.hidden = NO;
    [self setBlackStatus:YES];
}

- (void)initUI {
    _tabView = [[segmentedControlView alloc]initWithFrame:CGRectMake(0, 120, KScreenWidth, 40)];
    self.tabView.items = @[@"买单列表", @"卖单列表"];
    self.tabView.delegate = self;
    [self.view addSubview:_tabView];
    _pageContentView = [[UIView alloc]initWithFrame:CGRectMake(0, 190, KScreenWidth, KScreenHeight - 190)];
    [self.view addSubview:_pageContentView];
    self.pageVC = [[DWPageViewController alloc] initWithViewControllers:@[[JiaoYiOrderBuyViewController new], [JiaoYiOrderSellViewController new]]];
    self.pageVC.delegate = self;
    [self addViewController:self.pageVC];
}

-(void)changesegmentedIndex:(NSInteger)index
{
    self.pageVC.selectIndex = (unsigned int)index;
}

- (void)addViewController:(UIViewController *)pageVC
{
    [self addChildViewController:pageVC];
    [self.pageContentView addSubview:pageVC.view];
    [pageVC didMoveToParentViewController:self];
}

- (void)pageViewController:(DWPageViewController *)pageViewController didScrollToIndex:(int)index
{
    
}

- (void)pageViewController:(DWPageViewController *)pageViewController didScrollBetweenIndex1:(int)index1 index2:(int)index2 withPercent:(CGFloat)percent
{
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
